package org.niu.array;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class FindMedianinTwoSortedAray {
    public int findMedianinTwoSortedAray (int[] arr1, int[] arr2) {
        // write code here
        int len1 = arr1.length,len2 = arr2.length;
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < len1; i++) {
            list.add(arr1[i]);
        }for (int j = 0; j < len2; j++) {
            list.add(arr2[j]);
        }
        Collections.sort(list);
        return list.get((len1+len2)/2);
    }
}
